<?php
/**
 * FTP file operations library. First tries to use filesystem command and if
 * they fail to complete the task, FTP connection is established to do the
 * neccessary.
 *
 * @author Martin "DevelX" Jurča
 * @version 2009-01-07
 */
interface FTP {
    /**
     * Creates new directory within the filesystem and sets access right for
     * it.
     *
     * @param String $path Path to the new directory.
     * @param int $mode Octal code for access rights. For rwxrwxrwx use 0777.
     *        This is also default settings.
     * @return boolean True on success, false otherwise.
     */
    public static function mkdir($path, $mode = 0777);

    /**
     * Removes directory and all content of it from the filesystem.
     *
     * @param String $path Path to the directory ended with directory name.
     * @return boolean True on success, false otherwise.
     */
    public static function rmdir($path);

    /**
     * Creates file.
     *
     * @param String $path Path to the new directory.
     * @param int $mode Octal code for access rights. For rwxrwxrwx use 0777.
     *        This is also default settings.
     * @return boolean True on success, false otherwise.
     */
    public static function createFile($path, $mode = 0777);

    /**
     * Deletes file.
     *
     * @param String $path Path to the file.
     * @return boolean True on success, false otherwise.
     */
    public static function deleteFile($path);

    /**
     * Changes permissions to the file or directory.
     *
     * @param String $path Path to the file or directory.
     * @param int $mode Octal code for access right. For rwxrwxrwx use 0777.
     *        This is also default settings.
     */
    public static function chmod($path, $mode = 0777);

    /**
     * Closes FTP connection.
     */
    public static function close();
}
?>
